﻿using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Primitives;
using System.IO;

namespace ZYing.LiquidThemeEngine.FileProviders
{
    public class NullLiquidThemeFileProvider : ILiquidThemeFileProvider
    {
        private NullLiquidThemeFileProvider()
        {

        }
        public static NullLiquidThemeFileProvider Instance { get; } = new NullLiquidThemeFileProvider();
        public ILiquidThemeDirectoryContents GetDirectoryContents(string theme, string path)
        {
            return NullLiquidThemeDirectoryContents.Instance;
        }
        public ILiquidThemeFileInfo GetFileInfo(string theme, string path)
        {
            if (string.IsNullOrWhiteSpace(path)) throw new System.ArgumentNullException(nameof(path));
            return new NullLiquidThemeFileInfo(Path.GetFileName(path));
        }

        public IChangeToken Watch(string theme, string filter)
        {
            return NullChangeToken.Singleton;
        }
    }
}
